#include "IntermediateBase.h"
#include "Block.h"
#include "DoorBlock.h"
#include "HoleBlock.h"
#include "ShortBlock.h"
#include "ShortHoleBlock.h"
#include "ShortWindowBlock.h"

#include <GL/glut.h>
#include <cmath>

enum robotParts {NUCLEAR, PHASERS};

IntermediateBase::IntermediateBase(int robotPart):robotPt(robotPart) {}

void IntermediateBase::display() {

	glPushMatrix();

		// Locate at square 1,1 aprox (x,z plane) on the map--by default
		glTranslatef(2.5, 0.75, 1.5);

		//center block of base
		dbl.desertMilitaryDisplay();

		glPushMatrix();
			//left block of base
			glTranslatef(-1.0, -0.25, 0.0);
			bl.desertMilitaryDisplay();
		glPopMatrix();

		glPushMatrix();
			//right block of base
			glTranslatef(1.0, -0.25, 0.0);
			bl.desertMilitaryDisplay();
		glPopMatrix();

		glPushMatrix();
			//left small block of base
			glTranslatef(-1.0, -0.5, 1.0);
			swbl.desertMilitaryDisplay();
		glPopMatrix();

		glPushMatrix();
			//right small block of base
			glTranslatef(1.0, -0.5, 1.0);
			swbl.desertMilitaryDisplay();
		glPopMatrix();

		glPushMatrix();
			// translate the robot part to put it on top of the base
			glTranslatef(0, 0.25, 0);
			// add the robot part they make
			switch(robotPt)
			{
				case 0:
					// nuke
					glPushMatrix();
						//glTranslatef(0, 0.25, 0);
						glRotatef(-22.5, 0, 1, 0);
						nuke.display();
					glPopMatrix();
					break;
				case 1:
					// missiles
					glPushMatrix();
						//glTranslatef(0.0, 0.35, 0.0);
						missiles.display();
					glPopMatrix();
					break;
				case 2:
					// cannon
					glPushMatrix();
						//glTranslatef(0.0, 0.35, 0.0);
						cannon.display();
					glPopMatrix();
					break;
				case 3:
					// electronic brain
					glPushMatrix();
						//glTranslatef(0.0, 0.45, 0.0);
						eBrain.display();
					glPopMatrix();
					break;
				case 4:
					// phaser
					glPushMatrix();
						//glTranslatef(0.0, 0.35, 0.0);
						phasers.display();
					glPopMatrix();
					break;
			}
		glPopMatrix();

	glPopMatrix();
}

IntermediateBase::~IntermediateBase(void) {}


